package com.javaspeak.designpatterns.go4.behavioural.visitor;

/**
 * The calling code, ApplicationVisitor calls the accept method passing in
 * a SmallShapeVisitor or BigShapeVisitor. The accept method in turn calls the
 * overloaded visit method of SmallShapevisitor or BigShapeVisitor.
 *
 * @author John Dickerson
 */
public class SquareVisitable implements ShapeVisitable {

    /**
     * This method is specific to SquareVisitable and is not in
     * TriangleVisitable.  Note that a reference to this class is passed into
     * the accept(..) method as "this". Internally the Visitors,
     * SmallShapeVisitor and BigShapeVisitor call getTitle() to add a title to
     * the Square.
     *
     * @return Title of Square
     */
    String getTitle(){

        return "Square";
    }


    /* (non-Javadoc)
     * @see com.javaspeak.designpatterns.go4.behavioural.visitor.
     *      ShapeVisitable#accept(com.javaspeak.designpatterns.go4.
     *          behavioural.visitor.ShapeVisitor)
     */
    @Override
    public void accept( ShapeVisitor shapeVisitor ) {

        shapeVisitor.visit( this );
    }
}
